<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no">
<meta content="telephone=no" name="format-detection">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<title>{$news.title}</title>
<link href="__PUBLIC__/user/shop/css/buy.css" type="text/css" rel="stylesheet">
<script language="javascript">
//判断手机号码格式是否合法
function check_tel(obj){
 var objvalue=obj.value;
 var regx=/^(?:13\d|15\d|18[123456789])-?\d{5}(\d{3}|\*{3})$/;
 if(regx.test(objvalue)){
  return 1;
 }else{
  return 0;
 }
}
</script>
</head>
<body>
<?php if($news['content']){?>
<section class="item_sec">
  <div class="item_wrap rel"> <?php echo htmlspecialchars_decode($news['content']); ?> </div>
</section>
<?php }?>
<div style="clear:both"></div>
<form id="form_buy" action="{:U('/user/shop/buy_do','','')}" method="post">
  <input type="hidden" name="item_id" value="{$item.id}">
  <input type="hidden" name="uid"  value="{:I('get.uid')}">
  <?php $suk= json_decode($item['suk'],true);?>
  <?php foreach ($suk as $key=>$v): ?>
  <?php if($key==1){ ?>
  <input type="hidden" name="suk_key" id="suk_key" value="{$key}">
  <input type="hidden" name="suk_name" id="suk" value="{$v['name']}">
  <input type="hidden" name="suk_price"  id="jg"  value="{$v['price']}">
  <input type="hidden" name="suk_ticheng"  id="fc"  value="{$v['ticheng']}">
  <?php }?>
  <?php endforeach;?>
  <section class="item_sec"> <img src="__PUBLIC__/user/shop/images/tita.gif" id="buy">
    <div class="item_wrap rel">
      <ul>
        <?php if(!$news){?>
        <li><img src="<?php echo $item['litpic'];?>" width="100%"></li>
        <?php } ?>
        <li style="margin:15px 0px 15px 0px;" class="i_pri" ><b>{$item.title}</b></li>
      </ul>
      <ul class="sku_ul">
        <?php $suk= json_decode($item['suk'],true);?>
        <?php foreach ($suk as $key=>$v): ?>
        <?php if($key==1){ $price=$v['price'];  }?>
        <li><a data-jg="{$v.price}" data-suk="{$v.name}" data-key="{$key}" data-fc="{$v.ticheng}">{$v.name}</a></li>
        <?php endforeach;?>
      </ul>
      <p class="row">
        <label>价　格 </label>
        <span class="i_pri" id="item_price">￥{$price}</span> </p>
      <p>
        <input type="radio" name="identity" value="货到付款" checked="checked" />
        货到付款并包邮(支持开箱验货)</p>
      <p>已有:<span style="color:#ff0000">42845</span>人购买</p>
    </div>
    </div>
    </div>
  </section>
  <section class="item_sec">
    <div class="item_wrap add">
      <p class="row">
        <label for="name">收货人</label>
        <input required id="name" name="name" class="block input" tabindex="1" type="text" value="" />
      </p>
      <p class="row">
        <label for="tel">联系手机</label>
        <input required id="tel" name="tel" maxlength="11" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  class="block input" tabindex="2" type="tel" value="" />
      </p>
      <p class="row">
        <label for="province">选择地区</label>
        <select class="select" id="province" name="province" tabindex="3">
        </select>
        <select class="select" id="city" name="city" tabindex="4">
        </select>
        <select class="select" id="area" name="area" tabindex="5">
        </select>
      </p>
      <p class="row row_area">
        <label for="address">详细地址</label>
        <input required id="address" name="xxdz" class="block input" placeholder="街道门牌信息" tabindex="6" type="text" value="">
      </p>
    </div>
  </section>
  <footer>
    <button type="button" class="c_txt orange_bg"   id="buy_now">提交订单</button>
  </footer>
</form>
<script src="__PUBLIC__/user/shop/js/base_H5.js"></script> 
<script src="__PUBLIC__/user/shop/js/PCASClass.js"></script> 
<script>
var pcas = new PCAS("province,省份","city,城市","area,地区");
var Item = {
	getItemInfo : function(){
		
	},
	changeCount : function(){
		$("#name").bind("focusout",function(){
			var _this = $(this);
			var val = _this.val();
			if(1!=1){
				alert("用户不可为空");
				_this.val(1);
				return;
			}
			
		})
	},
	init : function(){
		
		$("#buy_now").bind("click", function() {
			
			var name=$("#name").val();
			var tel=$("#tel").val();
			var adress=$("#address").val();
			var pro=$("#province").val();
			var tel_check=check_tel(tel);
			if(name==''){
				alert("姓名不可为空");
				return;
				}else if(tel==''){
					alert("电话不可为空");
				return;
					}else if(tel.length !=11){
						alert("电话填写不正确");
						return;
							}else if(adress==''){
					alert("地址不可为空");
				return;
					}else if(pro==''){
					alert("地址不可为空");
				return;
					}else{
				$(this).attr("disabled", "disabled");
				Item.changeCount();
				Item.getItemInfo();
			document.getElementById("form_buy").submit();
			}
		});
	}
}
$(".sku_ul a").bind("click",function()
{
  //尺码点击
			var o = $(this);
			if(!o.hasClass("sku_cur"))
            {
				$(".sku_cur").removeClass("sku_cur");
				o.addClass("sku_cur");
				$("#item_price").html("￥"+ o.attr("data-jg"));
				$("#item_num").val(o.attr("data-jg"));
                $("#suk_key").val(o.attr("data-key"));
				$("#suk").val(o.attr("data-suk"));
				$("#fc").val(o.attr("data-fc"));
				$("#jg").val(o.attr("data-jg"));
			}
});
Item.init();
</script> 
<!--转化代码-->
<?php if(is_get_url()){?>
<?php
$data=array(
  'id'=>$id,
  'uid'=>$uid
  );
import("Lib.Jifei.Jifei");
$jifei= new \Jifei($data);
if($jifei->Simple()){
?>
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
<script src="/User/So?v=1.2"></script>
<script>addShare('<?php echo $id;?>', '<?php echo $uid;?>','<?php echo $token;?>');</script>
<?php }else{
 if(C("JIFEI_DEBUG")){ 
   //echo "<div style='height:50px;'></div>";
   echo "<div class='padding-top:50px;'>";
   echo "DEBUG:".$jifei->lanjiinfo;
   echo "</div>";
  }
}
?>
<?php } ?>
<!--转化代码-->
</body>
</html>
